package com.aube.mis.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.aube.mis.dto.ExtraConfigOptionDTO;
import com.aube.mis.service.ExtraConfigService;

@Controller
@RequestMapping(value = "/extraConfig")
public class ExtraConfigController extends AbstractController {

	private static Logger log = LoggerFactory.getLogger(ExtraConfigController.class);

	@Resource
	ExtraConfigService extraConfigService;

	@RequestMapping(value = "/getOptionList.ajax", produces = "text/plain;charset=UTF-8")
	@ResponseBody
	public String getOptionList(HttpServletResponse response, ModelMap map, String configId, String relatedId) {
		List<ExtraConfigOptionDTO> list = extraConfigService.getExtraConfigOptionList(relatedId, configId);
		Map<String, Object> dataMap = new HashMap<String, Object>();
		dataMap.put("list", list);
		return this.createSuccessResponse(dataMap);
	}
}
